package com.example.unifiedinterface.rest;

import com.example.unifiedinterface.client.OrderClient;
import com.example.unifiedinterface.entity.BaseRequestParam;
import com.example.unifiedinterface.entity.BaseResponse;
import com.example.unifiedinterface.entity.RequestHead;
import com.example.unifiedinterface.pojo.OrderParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.UUID;

/**
 * @Author: 19239
 * @Description:
 * @Date: 2024/5/21
 * @Version: 1.0
 */
@RestController
@RequestMapping("/order")
public class OrderRest {

    @Autowired
    private OrderClient orderClient;


    @PostMapping(value = "/send")
    public BaseResponse<String> sendOrder(@RequestBody OrderParam orderParam) {
        BaseRequestParam requestParam = new BaseRequestParam<OrderParam>();
        requestParam.setRequestHead(new RequestHead(UUID.randomUUID().toString(),"post"));
        requestParam.setData(orderParam);
        return orderClient.send(requestParam);
    }
}
